package ${package}.${moduleName}.respository.impl;

import ${package}.${moduleName}.entity.${ClassName};
import ${package}.${moduleName}.query.${ClassName}Query;
import ${package}.${moduleName}.mapper.${ClassName}Mapper;
import ${package}.${moduleName}.respository.${ClassName}Repository;


import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * ${tableComment}
 *
* @author ${author}
* @since ${date}
 */
@Service
@RequiredArgsConstructor
public class ${ClassName}RepositoryImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements ${ClassName}Repository {


    @Override
    public Page<${ClassName}> page(${ClassName}Query query) {
    return new LambdaQueryChainWrapper<>(baseMapper)
    .orderByDesc(${ClassName}::getLastModifiedTime)
    .page(new Page<>(query.getPageNum(), query.getPageSize()));
    }
        
    @Override
    public ${ClassName} get${ClassName}ById(String id){
      return baseMapper.selectById(id);
    }

        
    @Override
    public int save${ClassName}(${ClassName} entity) {
        return baseMapper.insert(entity);
    }

    @Override
    public int update${ClassName}(${ClassName} entity) {
        return baseMapper.updateById(entity);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteByIds(List<String> idList) {
        return baseMapper.deleteBatchIds(idList);
    }

}